JP2009060324A - Time stamp addition device, time stamp addition method, and program - Google Patents

Time stamp addition device, time stamp addition method, and program Download PDF

Info

Publication number
JP2009060324A
JP2009060324A JP2007225205A JP2007225205A JP2009060324A JP 2009060324 A JP2009060324 A JP 2009060324A JP 2007225205 A JP2007225205 A JP 2007225205A JP 2007225205 A JP2007225205 A JP 2007225205A JP 2009060324 A JP2009060324 A JP 2009060324A
Authority
JP
Japan
Prior art keywords
packet
pcr
packets
time stamp
embedded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2007225205A
Other languages
Japanese (ja)
Inventor
Harukazu Komoriya
陽多 小森谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sony Corp
Original Assignee
Sony Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sony Corp filed Critical Sony Corp
Priority to JP2007225205A priority Critical patent/JP2009060324A/en
Publication of JP2009060324A publication Critical patent/JP2009060324A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To reduce a burden for processing of adding a time stamp. <P>SOLUTION: PCR on the basis of a system clock frequency of 27 MHz is embedded in a predetermined transport packet among a plurality of transport packets. A PCR detection part 14 detects the transport packet in which the PCR is embedded, a time interval calculation part 15 calculates an interval of input timing between the adjacent transport packets based on the transport packet in which the PCR is embedded. Then, a time stamp calculation part 16 calculates the input timing of the transport packets based on intervals of the transport packets, and adds time stamps indicating the input timing to the plurality of transport packets, respectively. The present invention is applicable, for example, to a hard disk recorder. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、タイムスタンプ付加装置およびタイムスタンプ付加方法、並びにプログラムに関し、特に、タイムスタンプを付加する処理にかかる負担を軽減することができるようにしたタイムスタンプ付加装置およびタイムスタンプ付加方法、並びにプログラムに関する。   The present invention relates to a time stamp adding apparatus, a time stamp adding method, and a program, and more particularly to a time stamp adding apparatus, a time stamp adding method, and a program capable of reducing a burden on processing for adding a time stamp. About.

近年、テレビジョン放送されている番組をハードディスクなどの記録媒体に記録し、その後、記録媒体に記録されている番組を再生して、ユーザが視聴することができるディジタル機器の普及が拡大している。このようなディジタル機器としては、ハードディスクレコーダや、パーソナルコンピュータ、録画機能を備えたテレビジョン放送受像機などがある。   In recent years, there has been an increase in the spread of digital devices that allow a user to view a television broadcast program recorded on a recording medium such as a hard disk and then play the program recorded on the recording medium. . Examples of such digital equipment include a hard disk recorder, a personal computer, and a television broadcast receiver having a recording function.

日本のテレビジョン放送における規格としては、国際標準規格であるMPEG(Moving Picture Experts Group)の中でも、通信システムや放送システムへの適用が考慮されているMPEG-2システムが採用されている。さらに、MPEG-2システムの中でも、伝送時に誤りが発生する環境での伝送や蓄積などに適したMPEG2-TSと呼ばれる形式が採用されている。   As a standard for television broadcasting in Japan, the MPEG-2 system, which is considered to be applied to communication systems and broadcasting systems, is adopted in the MPEG (Moving Picture Experts Group) which is an international standard. Further, among MPEG-2 systems, a format called MPEG2-TS suitable for transmission and storage in an environment where errors occur during transmission is employed.

MPEG2-TSでは、送信側の装置は、MPEG-2で符号化された画像および音声を、TS(Transport Stream:トランスポートストリーム)パケットと呼ばれるパケットに分割し、TSパケットを順次送信する。   In MPEG2-TS, an apparatus on the transmission side divides an image and audio encoded in MPEG-2 into packets called TS (Transport Stream) packets, and sequentially transmits TS packets.

また、MPEG2-TSでは、送信側が意図したとおりに受信側で番組を再生することができるように、TSパケットには、27MHzのシステムクロック周波数を基準としたPCR(Program Clock Reference:プログラムクロックリファレンス)が埋め込まれる。同様に、TSパケットには、再生時に参照される時刻管理情報であるPTS(Program Time Stamp:プログラムタイムスタンプ)や、デコード時に参照される時刻管理情報であるDTS(Decoding Time Stamp:デコーディングタイムスタンプ)などのデータも埋め込まれる。   Also, in MPEG2-TS, PCR (Program Clock Reference) is based on the system clock frequency of 27 MHz in the TS packet so that the program can be played back on the receiving side as intended by the transmitting side. Is embedded. Similarly, in the TS packet, PTS (Program Time Stamp) which is time management information referred to at the time of reproduction and DTS (Decoding Time Stamp) which is time management information referred to at the time of decoding are included in the TS packet. ) Etc. are also embedded.

上述したようなディジタル機器などの受信側の装置は、TSパケットを受信し、そのTSパケットから、PAT(Program Association Table:プログラムアソシエーションテーブル)、およびPMT(Program Map Table:プログラムマップテーブル)を取得する。受信側の装置は、PATおよびPMTに基づいて、PID(Packet Identifier:パケット識別子)を判別することができ、所定のPIDを持つTSパケットを、映像や、音声、PCRなどに分離する。   A device on the receiving side such as a digital device as described above receives a TS packet, and acquires a PAT (Program Association Table) and a PMT (Program Map Table) from the TS packet. . The receiving device can determine a PID (Packet Identifier) based on PAT and PMT, and separates a TS packet having a predetermined PID into video, audio, PCR, or the like.

また、受信側の装置は、TSパケットから取得したPCRを使用して、STC(System Time Clock:システムタイムクロック)の初期値を設定する。また、受信側の装置は、定期的に受信されるPCRの値と、STCとを比較し、デコードのタイムベースとなる27MHzのシステムクロック周波数の誤差を調節する。   In addition, the receiving-side apparatus sets an initial value of an STC (System Time Clock) using the PCR acquired from the TS packet. Further, the receiving-side apparatus compares the PCR value periodically received with the STC, and adjusts the error of the 27 MHz system clock frequency that becomes the decoding time base.

一般に、放送局などの送信側の装置から送出されたTSパケットが、受信側の装置において映像および音声のデコード処理時に、TSパケットなどを一時的に蓄積する受信バッファのアンダーフローおよびオーバフローが発生せず、かつ、映像と音声との間の同期処理が正常になるように、受信側の装置は実装される。   In general, when TS packets sent from a transmitting device such as a broadcasting station are used to decode video and audio at the receiving device, underflow and overflow of the reception buffer that temporarily stores TS packets and the like occur. In addition, the device on the receiving side is mounted so that the synchronization processing between video and audio is normal.

ところで、MPEG2-TSを用いた映像コンテンツは、IPTV(Internet Protocol Television)などのネットワークを経由した配信が行われる場合があり、またDLNA(Digital Living Network Alliance)などに代表されるホームネットワーク環境下での配信が行われる場合もある。   By the way, video content using MPEG2-TS may be distributed via networks such as IPTV (Internet Protocol Television), and in home network environments represented by DLNA (Digital Living Network Alliance) and the like. May be delivered.

このようなネットワークを介した映像コンテンツの配信において、送信側の装置が、TSパケットの出力タイミングを正確に制御したとしても、ネットワーク内で、TSパケットが異なる経路を通過する可能性があり、TSパケットの到着時間が、送信間隔に従わないことがある。また、ネットワーク内の中継機器が、MPEG2-TSの処理とは全く関係ない他の通信処理を同時に行うようなときも、TSパケットの到着時間が、送信間隔に従わないことがある。   In the distribution of video content via such a network, even if the transmission-side device accurately controls the output timing of the TS packet, the TS packet may pass through different routes in the network. Packet arrival time may not follow the transmission interval. Also, the arrival time of TS packets may not follow the transmission interval when a relay device in the network simultaneously performs other communication processing that has nothing to do with MPEG2-TS processing.

また、時刻情報であるPCRは、100ms以内に最低1つ含まれるものと規定されており、全てのTSパケットに含まれるわけではない。よって、受信側の装置が、ネットワークを介して伝送されるTSパケットのPCRのみを参照して、送信側の装置が期待するタイミングで受信したTSパケットを、デコーダへ入力することは困難である。   Further, it is stipulated that at least one PCR as time information is included within 100 ms, and is not included in all TS packets. Therefore, it is difficult for the receiving apparatus to input only the TS packet received at the timing expected by the transmitting apparatus with reference to the PCR of the TS packet transmitted via the network.

従って、ネットワークを介した映像コンテンツの配信では、送信側の装置が、個々のTSパケットにタイムスタンプ(デコーダへの入力タイミング)を付加し、受信側の装置が、TSパケットに付加されているタイムスタンプを使用して、そのTSパケットをデコードするタイミングを制御する方法が、有効である。   Therefore, in the distribution of video content via the network, the transmitting device adds a time stamp (input timing to the decoder) to each TS packet, and the receiving device adds the time added to the TS packet. A method of using the stamp to control the timing for decoding the TS packet is effective.

従って、例えば、テレビジョン放送されたコンテンツを、録画機器などにおいてMPEG2-TSで記録し、そのコンテンツをホームネットワークへ送出する場合には、録画機器が、TSパケットにタイムスタンプを付加する処理を行う必要がある。また、タイムスタンプが付加されていないMPEG2-TSを、IPTVなどのネットワークを経由して配信する場合にも、同様に、配信装置は、TSパケットにタイムスタンプを付加する処理を行う必要がある。   Therefore, for example, when a content broadcast on television is recorded in MPEG2-TS in a recording device and the content is transmitted to the home network, the recording device performs processing for adding a time stamp to the TS packet. There is a need. Similarly, when distributing MPEG2-TS without a time stamp via a network such as IPTV, the distribution apparatus needs to perform processing for adding a time stamp to the TS packet.

しかしながら、一般的に、録画機器などの組み込み機器に搭載されているCPU(Central Processing Unit)は、処理速度が低速であり、例えば、コンテンツの長さが長い場合などには、タイムスタンプを付加する処理に占有されてしまう。即ち、録画機器などの組み込み機器にとって、タイムスタンプを付加する処理にかかる負担は大きくなる。   However, in general, a CPU (Central Processing Unit) mounted in an embedded device such as a recording device has a low processing speed. For example, when a content is long, a time stamp is added. It will be occupied by processing. In other words, a burden on processing for adding a time stamp increases for an embedded device such as a recording device.

また、処理速度が高速で、高性能なCPUを録画機器などに搭載することで、タイムスタンプを付加する処理の負担が大きくなることを解決することができるが、そのような解決では、録画機器などの製造コストが高くなってしまう。   In addition, installing a high-performance CPU with high processing speed in a recording device can solve the problem of increasing the processing burden of adding time stamps. The manufacturing cost becomes high.

ここで、特許文献1には、時刻情報の連続性および周期性を保ち、様々な伝送速度に対応したトランスポートストリームを発生させる技術が開示されている。   Here, Patent Document 1 discloses a technique for maintaining the continuity and periodicity of time information and generating transport streams corresponding to various transmission rates.

また、特許文献2には、非同期の複数のトランスポートストリームの多重時に発生する遅延揺らぎを防止する技術が開示されている。   Patent Document 2 discloses a technique for preventing delay fluctuation that occurs when a plurality of asynchronous transport streams are multiplexed.

特開2001−285233号公報JP 2001-285233 A 特開平11−41193号公報Japanese Patent Laid-Open No. 11-41193

上述したように、録画機器などの組み込み機器にとって、TSパケットにタイムスタンプを付加する処理にかかる負担が大きい。   As described above, an embedded device such as a recording device has a large burden on processing for adding a time stamp to a TS packet.

本発明は、このような状況に鑑みてなされたものであり、TSパケットにタイムスタンプを付加する処理にかかる負担を軽減することができるようにするものである。   The present invention has been made in view of such a situation, and is intended to reduce the burden on processing for adding a time stamp to a TS packet.

本発明の一側面のタイムスタンプ付加装置は、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加装置において、複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCRが埋め込まれており、前記PCRが埋め込まれているTSパケットを検出する検出手段と、前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出する時間間隔算出手段と、前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加するタイムスタンプ算出手段とを備える。   The time stamp adding apparatus according to one aspect of the present invention is a time stamp adding apparatus that adds a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS. The predetermined TS packet of the plurality of TS packets is embedded with a PCR based on a predetermined system clock frequency, and detection means for detecting the TS packet in which the PCR is embedded, and the PCR Based on the embedded TS packet, a time interval calculating means for calculating an input timing interval between adjacent TS packets, and calculating an input timing of the TS packet based on an input timing interval between the TS packets. Time stamp calculation for adding a time stamp indicating the input timing to each of the plurality of TS packets. Means.

本発明の一側面のタイムスタンプ付加方法またはプログラムは、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加方法、または、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加する処理をコンピュータに実行させるプログラムにおいて、複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCRが埋め込まれており、前記PCRが埋め込まれているTSパケットを検出し、前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出し、前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加するステップを含む。   A time stamp addition method or program according to one aspect of the present invention is a time stamp addition method for adding a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS. Alternatively, in a program for causing a computer to execute processing for adding a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS, The predetermined TS packet includes a PCR embedded with a predetermined system clock frequency as a reference, detects the TS packet in which the PCR is embedded, and based on the TS packet in which the PCR is embedded The input timing interval between adjacent TS packets is calculated, and the input timing between the TS packets is calculated. Based on the spacing of grayed, the calculated input timing of the TS packet includes the step of adding each time stamp representing the input timing to the plurality of TS packets.

本発明の一側面においては、MPEG2-TSに含まれる複数のTSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCRが埋め込まれている。そして、PCRが埋め込まれているTSパケットが検出され、PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔が算出される。そして、TSパケット同士の入力タイミングの間隔に基づいて、TSパケットの入力タイミングが算出され、入力タイミングを表すタイムスタンプが複数のTSパケットにそれぞれ付加される。   In one aspect of the present invention, a PCR based on a predetermined system clock frequency is embedded in a predetermined TS packet among a plurality of TS packets included in MPEG2-TS. Then, the TS packet in which the PCR is embedded is detected, and the interval between the input timings of adjacent TS packets is calculated based on the TS packet in which the PCR is embedded. Then, the input timing of the TS packet is calculated based on the input timing interval between the TS packets, and a time stamp indicating the input timing is added to each of the plurality of TS packets.

本発明の一側面によれば、タイムスタンプを付加する処理にかかる負担を軽減することができる。   According to one aspect of the present invention, it is possible to reduce a burden on processing for adding a time stamp.

以下に本発明の実施の形態を説明するが、本発明の構成要件と、明細書又は図面に記載の実施の形態との対応関係を例示すると、次のようになる。この記載は、本発明をサポートする実施の形態が、明細書又は図面に記載されていることを確認するためのものである。従って、明細書又は図面中には記載されているが、本発明の構成要件に対応する実施の形態として、ここには記載されていない実施の形態があったとしても、そのことは、その実施の形態が、その構成要件に対応するものではないことを意味するものではない。逆に、実施の形態が構成要件に対応するものとしてここに記載されていたとしても、そのことは、その実施の形態が、その構成要件以外の構成要件には対応しないものであることを意味するものでもない。   Embodiments of the present invention will be described below. Correspondences between the constituent elements of the present invention and the embodiments described in the specification or the drawings are exemplified as follows. This description is intended to confirm that the embodiments supporting the present invention are described in the specification or the drawings. Therefore, even if there is an embodiment which is described in the specification or the drawings but is not described here as an embodiment corresponding to the constituent elements of the present invention, that is not the case. It does not mean that the form does not correspond to the constituent requirements. Conversely, even if an embodiment is described here as corresponding to a configuration requirement, that means that the embodiment does not correspond to a configuration requirement other than the configuration requirement. It's not something to do.

本発明の一側面のタイムスタンプ付加装置は、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加装置において、
複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCR(Program Clock Reference)が埋め込まれており、前記PCRが埋め込まれているTSパケットを検出する検出手段(例えば、図1のPCR検出部14)と、
前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出する時間間隔算出手段(例えば、図1の時間間隔算出部15)と、
前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加するタイムスタンプ算出手段(例えば、図1のタイムスタンプ算出部16)と
を備える。
The time stamp adding apparatus according to one aspect of the present invention is a time stamp adding apparatus that adds a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS.
Detection means for detecting a TS packet in which the PCR is embedded, in a predetermined TS packet of the plurality of TS packets, embedded with a PCR (Program Clock Reference) based on a predetermined system clock frequency (For example, the PCR detection unit 14 in FIG. 1);
Based on the TS packet in which the PCR is embedded, time interval calculating means (for example, the time interval calculating unit 15 in FIG. 1) that calculates the interval of the input timing between adjacent TS packets;
Based on the input timing interval between the TS packets, the TS packet input timing is calculated, and a time stamp calculating means (for example, FIG. 1) adds a time stamp indicating the input timing to each of the TS packets. And a time stamp calculation unit 16).

また、本発明の一側面のタイムスタンプ付加装置は、
複数の前記TSパケットには、それぞれを識別するPIDが含まれており、
前記TSパケットのPIDのリストが記述されているPMTを伝送するTSパケットのPID、または、前記PCRが埋め込まれているTSパケットのPIDを記憶する記憶手段(例えば、図1のメモリ12)
をさらに備え、
前記検出手段は、
前記記憶手段に記憶されている前記PMTを伝送するTSパケットのPIDにより識別されるTSパケットのPMTを解析して、前記PCRが埋め込まれているTSパケットのPIDを検出し、前記PCRが埋め込まれているTSパケットのPIDに基づいて、前記PCRが埋め込まれているTSパケットを検出し、
または、前記記憶手段に記憶されている前記PCRが埋め込まれているTSパケットのPIDに基づいて、前記PCRが埋め込まれているTSパケットを検出する。
Further, a time stamp adding device according to one aspect of the present invention is provided.
The plurality of TS packets include a PID that identifies each of the TS packets,
Storage means for storing the PID of the TS packet that transmits the PMT in which the PID list of the TS packet is described, or the PID of the TS packet in which the PCR is embedded (for example, the memory 12 in FIG. 1)
Further comprising
The detection means includes
Analyzing the PMT of the TS packet identified by the PID of the TS packet that transmits the PMT stored in the storage means, detects the PID of the TS packet in which the PCR is embedded, and the PCR is embedded Based on the PID of the TS packet, the TS packet in which the PCR is embedded is detected,
Alternatively, the TS packet embedded with the PCR is detected based on the PID of the TS packet embedded with the PCR stored in the storage means.

また、本発明の一側面のタイムスタンプ付加装置は、
前記検出手段が、
前記PCRが埋め込まれているTSパケットのデータ構造に基づいて、前記TSパケットの所定の箇所から、前記PCRの値を抽出するPCR値抽出手段(例えば、図4のステップS47の処理を実行する図1のPCR検出部14)と、
前記PCRが埋め込まれているTSパケットのMPEG2-TS中における位置を表す位置情報を取得する位置情報取得手段(例えば、図4のステップS48の処理を実行する図1のPCR検出部14)と
を有し、
前記PCR値抽出手段が抽出したPCRの値と、前記位置情報取得手段が取得した位置情報とを、前記時間間隔算出手段に供給する。
Further, a time stamp adding device according to one aspect of the present invention is provided.
The detecting means;
Based on the data structure of the TS packet in which the PCR is embedded, PCR value extracting means for extracting the PCR value from a predetermined location of the TS packet (for example, a diagram for executing the processing of step S47 in FIG. 4) 1 PCR detection unit 14),
Position information acquisition means for acquiring position information indicating the position in the MPEG2-TS of the TS packet in which the PCR is embedded (for example, the PCR detection unit 14 of FIG. 1 that executes the process of step S48 of FIG. 4); Have
The PCR value extracted by the PCR value extracting means and the position information acquired by the position information acquiring means are supplied to the time interval calculating means.

本発明の一側面のタイムスタンプ付加方法またはプログラムは、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加方法、または、MPEG2-TSに含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加する処理をコンピュータに実行させるプログラムであって、
複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCRが埋め込まれており、前記PCRが埋め込まれているTSパケットを検出し(例えば、図3のステップS22)、
前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出し(例えば、図3のステップS14)、
前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加する(例えば、図3のステップS32)
ステップを含む。
A time stamp addition method or program according to one aspect of the present invention is a time stamp addition method for adding a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS. Or a program for causing a computer to execute a process of adding a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS packets included in the MPEG2-TS,
A predetermined TS packet among the plurality of TS packets is embedded with a PCR based on a predetermined system clock frequency, and the TS packet in which the PCR is embedded is detected (for example, step of FIG. 3). S22),
Based on the TS packet in which the PCR is embedded, the interval of the input timing between adjacent TS packets is calculated (for example, step S14 in FIG. 3),
Based on the input timing interval between the TS packets, the input timing of the TS packet is calculated, and a time stamp indicating the input timing is added to each of the plurality of TS packets (for example, step S32 in FIG. 3).
Includes steps.

以下、本発明を適用した具体的な実施の形態について、図面を参照しながら詳細に説明する。   Hereinafter, specific embodiments to which the present invention is applied will be described in detail with reference to the drawings.

図1は、本発明を適用したタイムスタンプ付加装置の一実施の形態の構成例を示すブロック図である。   FIG. 1 is a block diagram showing a configuration example of an embodiment of a time stamp adding apparatus to which the present invention is applied.

図1において、タイムスタンプ付加装置11は、メモリ12、CPU13、PCR検出部14、時間間隔算出部15、タイムスタンプ算出部16、およびシステムバス17から構成される。   In FIG. 1, the time stamp adding device 11 includes a memory 12, a CPU 13, a PCR detection unit 14, a time interval calculation unit 15, a time stamp calculation unit 16, and a system bus 17.

CPU13には、メモリ12が接続されており、CPU13、PCR検出部14、およびタイムスタンプ算出部16が、システムバス17を介して互いに接続されている。また、CPU13が、ソフトウェアを実行することにより、時間間隔算出部15の機能が実現される。   A memory 12 is connected to the CPU 13, and a CPU 13, a PCR detection unit 14, and a time stamp calculation unit 16 are connected to each other via a system bus 17. Moreover, the function of the time interval calculation part 15 is implement | achieved when CPU13 runs software.

メモリ12には、タイムスタンプを付加する処理の対象となるMPEG2-TS(以下、適宜、タイムスタンプ無しMPEG2-TSと称する)が、あらかじめ記憶されている。また、メモリ12には、タイムスタンプ無しMPEG2-TSにタイムスタンプを付加する処理が施され、その結果得られるタイムスタンプ付きMPEG2-TSが記憶される。   In the memory 12, MPEG2-TS (hereinafter, appropriately referred to as “no time stamp MPEG2-TS”) to be processed for adding a time stamp is stored in advance. Further, the memory 12 performs processing for adding a time stamp to the MPEG2-TS without time stamp, and stores the MPEG2-TS with time stamp obtained as a result.

CPU13は、タイムスタンプ無しMPEG2-TSをメモリ12から読み出し、システムバス17を介して、PCR検出部14に供給する。   The CPU 13 reads MPEG2-TS without time stamp from the memory 12 and supplies it to the PCR detection unit 14 via the system bus 17.

PCR検出部14は、CPU13から供給されるMPEG2-TSを解析し、27MHzのシステムクロック周波数を基準としたPCRが埋め込まれているTSパケットを検出する。   The PCR detection unit 14 analyzes the MPEG2-TS supplied from the CPU 13 and detects a TS packet in which a PCR is embedded with a system clock frequency of 27 MHz as a reference.

例えば、PCR検出部14は、MPEG2-TSの所定のTSパケット(PIDが0であるTSパケット)に示されているPATを解析して、PMTが含まれているTSパケットのPIDを検出し、このPIDにより識別されるTSパケットに含まれているPMTを解析して、PCRが埋め込まれているTSパケットのPIDを検出する。そして、PCRが埋め込まれているTSパケットのPIDに基づいて、PCRが埋め込まれているTSパケットを検出する。   For example, the PCR detection unit 14 analyzes the PAT indicated in a predetermined TS packet of MPEG2-TS (TS packet having a PID of 0), detects the PID of the TS packet including the PMT, The PMT included in the TS packet identified by this PID is analyzed, and the PID of the TS packet in which the PCR is embedded is detected. Then, the TS packet in which the PCR is embedded is detected based on the PID of the TS packet in which the PCR is embedded.

または、例えば、メモリ12に、PMTが含まれているTSパケットのPIDや、PCRが埋め込まれているTSパケットのPIDが、あらかじめ記憶されているときには、PCR検出部14は、それらのPIDに基づいて、PCRが埋め込まれているTSパケットを検出する。なお、メモリ12に記憶されるPMTやPCRが含まれているTSパケットのPIDは、例えば、ユーザが任意に設定したり、CPU13により実行される他のアプリケーションが任意に設定したりすることができる。   Alternatively, for example, when the PID of the TS packet including the PMT or the PID of the TS packet in which the PCR is embedded is stored in the memory 12 in advance, the PCR detection unit 14 may be based on the PID. The TS packet in which the PCR is embedded is detected. Note that the PID of the TS packet including the PMT and PCR stored in the memory 12 can be arbitrarily set by the user or can be arbitrarily set by another application executed by the CPU 13, for example. .

そして、PCR検出部14は、PCRが埋め込まれているTSパケットからPCR値を抽出するとともに、PCRを検出したTSパケットの位置情報を取得する。PCRを検出したTSパケットの位置情報としては、例えば、先頭のTSパケットから最初にPCRが検出されたTSパケットまでのパケット数、PCRが検出されたTSパケット間のパケット数、および最後にPCRが検出されたTSパケットから最後尾のTSパケットまでのパケット数が用いられる。   Then, the PCR detection unit 14 extracts the PCR value from the TS packet in which the PCR is embedded, and acquires the position information of the TS packet in which the PCR is detected. The location information of the TS packet that detected PCR includes, for example, the number of packets from the first TS packet to the TS packet where PCR was first detected, the number of packets between TS packets where PCR was detected, and finally PCR. The number of packets from the detected TS packet to the last TS packet is used.

また、PCR検出部14は、PCRが埋め込まれているTSパケットの検出が完了すると、その旨を表すPCR検出完了通知とともに、TSパケットから抽出したPCR値と、そのTSパケットの位置情報とを、システムバス17を介して、CPU13に供給する。   Further, when the detection of the TS packet in which the PCR is embedded is completed, the PCR detection unit 14, together with the PCR detection completion notification indicating that fact, the PCR value extracted from the TS packet and the position information of the TS packet, This is supplied to the CPU 13 via the system bus 17.

時間間隔算出部15は、PCR検出部14がCPU13に供給したPCR値と位置情報とに基づいて、隣り合うTSパケット同士の時間間隔(例えば、MPEG2-TSをデコードするデコーダへTSパケットが入力される入力タイミング(時刻)の間隔)などを算出し、その時間間隔を含む時間間隔データを取得する。CPU13は、時間間隔算出部15が取得する時間間隔データと、メモリ12から読み出したタイムスタンプ無しMPEG2-TSとを、システムバス17を介して、タイムスタンプ算出部16に供給する。   Based on the PCR value and position information supplied to the CPU 13 by the PCR detection unit 14, the time interval calculation unit 15 inputs a TS packet into a time interval between adjacent TS packets (for example, a decoder that decodes MPEG2-TS). The input timing (time interval) is calculated, and time interval data including the time interval is acquired. The CPU 13 supplies the time interval data acquired by the time interval calculation unit 15 and the time stampless MPEG2-TS read from the memory 12 to the time stamp calculation unit 16 via the system bus 17.

タイムスタンプ算出部16は、CPU13から供給される時間間隔データを用い、所定の式を演算して各TSパケットの入力タイミングを表す、例えば、4バイトのタイプスタンプを算出する。そして、タイムスタンプ算出部16は、そのタイムスタンプを、CPU13から供給されるタイムスタンプ無しMPEG2-TSのTSパケットにそれぞれ付加し、タイムスタンプ付きMPEG2-TSを取得する。その後、タイムスタンプ算出部16は、タイムスタンプ付きMPEG2-TSを、システムバス17を介してCPU13に供給し、CPU13は、タイムスタンプ付きMPEG2-TSをメモリ12に記憶させる。   The time stamp calculation unit 16 calculates, for example, a 4-byte type stamp representing the input timing of each TS packet by calculating a predetermined formula using the time interval data supplied from the CPU 13. Then, the time stamp calculation unit 16 adds the time stamp to the TS packet of the MPEG2-TS without time stamp supplied from the CPU 13 and acquires the MPEG2-TS with time stamp. Thereafter, the time stamp calculation unit 16 supplies the MPEG2-TS with time stamp to the CPU 13 via the system bus 17, and the CPU 13 stores the MPEG2-TS with time stamp in the memory 12.

次に、図2は、MPEG2-TSの構成例を示す図である。   Next, FIG. 2 is a diagram illustrating a configuration example of MPEG2-TS.

図2の上側には、タイムスタンプ付加装置11に入力されるタイムスタンプ無しMPEG2-TSが示されており、下側には、タイムスタンプを付加する処理が施されて出力されるタイムスタンプ付きMPEG2-TSが示されている。   The upper part of FIG. 2 shows the MPEG2-TS without time stamp input to the time stamp adding apparatus 11, and the lower part shows MPEG2 with time stamp that is output after being subjected to processing for adding a time stamp. -TS is shown.

タイムスタンプ無しMPEG2-TSは、188バイトのTSパケットが、複数、連続して構成されている。タイムスタンプ付きMPEG2-TSは、各TSパケットの先頭に、4バイトのタイムスタンプが付加された192バイトのタイムスタンプ付きTSパケットが、複数、連続して構成される。   MPEG2-TS without time stamp is composed of a plurality of 188-byte TS packets continuously. The MPEG2-TS with time stamp is composed of a plurality of 192-byte time-stamped TS packets in which a 4-byte time stamp is added at the beginning of each TS packet.

次に、図3は、図1のタイムスタンプ付加装置11が、MPEG2-TSにタイムスタンプを付加する処理を説明するフローチャートである。   Next, FIG. 3 is a flowchart for explaining processing in which the time stamp adding apparatus 11 in FIG. 1 adds a time stamp to MPEG2-TS.

初期状態として、メモリ12には、タイムスタンプ無しMPEG2-TSが記憶されており、ステップS11において、CPU13は、メモリ12からタイムスタンプ無しMPEG2-TSを読み出し、処理はステップS12に進む。   As an initial state, the time stampless MPEG2-TS is stored in the memory 12, and in step S11, the CPU 13 reads the time stampless MPEG2-TS from the memory 12, and the process proceeds to step S12.

ステップS12において、CPU13は、ステップS11でメモリ12から読み出したタイムスタンプ無しMPEG2-TSを、PCR検出部14に供給する。その後、CPU13は、PCR検出部14から、PCR検出完了通知とともに、PCRが埋め込まれているTSパケットから取得したPCR値と、そのTSパケットの位置情報とが送信されてくるまで、処理を待機し、それらが送信されてくると、処理はステップS13に進む。   In step S <b> 12, the CPU 13 supplies the MPEG2-TS without time stamp read from the memory 12 in step S <b> 11 to the PCR detection unit 14. After that, the CPU 13 waits for processing until the PCR value acquired from the TS packet in which the PCR is embedded and the position information of the TS packet are transmitted from the PCR detection unit 14 together with the PCR detection completion notification. When they are transmitted, the process proceeds to step S13.

ステップS13において、CPU13は、PCR検出部14から、PCR検出完了通知とともに送信されてくるPCR値と位置情報とを受信する。   In step S <b> 13, the CPU 13 receives the PCR value and the position information transmitted from the PCR detection unit 14 together with the PCR detection completion notification.

ステップS13の処理後、処理はステップS14に進み、CPU13では、時間間隔算出部15が、ステップS13で受信したPCR値と位置情報とを用いて、隣り合うTSパケット同士の時間間隔などを算出し、その時間間隔を含む時間間隔データを取得する。   After the process of step S13, the process proceeds to step S14. In the CPU 13, the time interval calculation unit 15 calculates the time interval between adjacent TS packets using the PCR value and the position information received in step S13. The time interval data including the time interval is acquired.

ステップS14の処理後、処理はステップS15に進み、CPU13は、ステップS14で時間間隔算出部15が取得した時間間隔データと、メモリ12から読み出したタイムスタンプ無しMPEG2-TSとをタイムスタンプ算出部16に供給する。その後、CPU13は、タイムスタンプ算出部16からタイムスタンプ付きMPEG2-TSが供給されてくるまで、処理を待機し、タイムスタンプ付きMPEG2-TSが送信されてくると、処理はステップS16に進む。   After step S14, the process proceeds to step S15, and the CPU 13 uses the time interval calculation unit 16 to obtain the time interval data acquired by the time interval calculation unit 15 in step S14 and the MPEG2-TS without time stamp read from the memory 12. To supply. Thereafter, the CPU 13 waits for processing until the time-stamped MPEG2-TS is supplied from the time stamp calculation unit 16, and when the time-stamped MPEG2-TS is transmitted, the processing proceeds to step S16.

ステップS16において、CPU13は、タイムスタンプ算出部16から送信されてくるタイムスタンプ付きMPEG2-TSを受信し、処理はステップS17に進む。   In step S16, the CPU 13 receives the MPEG2-TS with time stamp transmitted from the time stamp calculation unit 16, and the process proceeds to step S17.

ステップS17において、CPU13は、ステップS16で受信したタイムスタンプ付きMPEG2-TSをメモリ12に記憶させ、CPU13での処理は終了する。   In step S17, the CPU 13 stores the MPEG2-TS with the time stamp received in step S16 in the memory 12, and the processing in the CPU 13 ends.

一方、PCR検出部14は、ステップS12でCPU13が、タイムスタンプ無しMPEG2-TSを送信すると、ステップS21において、そのタイムスタンプ無しMPEG2-TSを受信する。   On the other hand, when the CPU 13 transmits the MPEG2-TS without time stamp in step S12, the PCR detection unit 14 receives the MPEG2-TS without time stamp in step S21.

ステップS21の処理後、処理はステップS22に進み、PCR検出部14は、タイムスタンプ無しMPEG2-TSを解析し、PCR値と位置情報を取得するPCR検出処理(後述する図4のフローチャートの処理)を行う。   After the process of step S21, the process proceeds to step S22, and the PCR detection unit 14 analyzes the MPEG2-TS without time stamp and acquires a PCR value and position information (a process of the flowchart of FIG. 4 described later). I do.

ステップS22のPCR検出処理の処理後、処理はステップS23に進み、PCR検出部14は、ステップS22で取得したPCR値と位置情報とともに、PCR検出処理が完了した旨を表すPCR検出完了通知を、CPU13に送信し、PCR検出部14での処理は終了する。   After the PCR detection process in step S22, the process proceeds to step S23, and the PCR detection unit 14 sends a PCR detection completion notification indicating that the PCR detection process is completed, together with the PCR value and position information acquired in step S22. The data is transmitted to the CPU 13, and the process in the PCR detection unit 14 ends.

一方、タイムスタンプ算出部16は、ステップS15でCPU13が、タイムスタンプ無しMPEG2-TSと時間間隔データとを送信すると、ステップS31において、そのタイムスタンプ無しMPEG2-TSと時間間隔データとを受信する。   On the other hand, when the CPU 13 transmits the MPEG2-TS without time stamp and the time interval data in step S15, the time stamp calculation unit 16 receives the MPEG2-TS without time stamp and the time interval data in step S31.

ステップS31の処理後、処理はステップS32に進み、タイムスタンプ算出部16は、ステップS31で受信した時間間隔データを用い、所定の式を演算して各TSパケットのタイプスタンプを算出する。そして、タイムスタンプ算出部16は、図2に示したように、各TSパケットの先頭にタイムスタンプを付加し、タイムスタンプ付きMPEG2-TSを取得して、処理はステップS33に進む。   After the process of step S31, the process proceeds to step S32, and the time stamp calculation unit 16 calculates a type stamp of each TS packet by calculating a predetermined formula using the time interval data received in step S31. Then, as shown in FIG. 2, the time stamp calculation unit 16 adds a time stamp to the head of each TS packet, acquires an MPEG2-TS with a time stamp, and the process proceeds to step S33.

ステップS33において、タイムスタンプ算出部16は、ステップS32で取得したタイムスタンプ付きMPEG2-TSをCPU13に供給し、タイムスタンプ算出部16での処理は終了する。   In step S33, the time stamp calculation unit 16 supplies the MPEG2-TS with time stamp acquired in step S32 to the CPU 13, and the processing in the time stamp calculation unit 16 ends.

次に、図4は、図3のステップS22のPCR検出処理を説明するフローチャートである。   Next, FIG. 4 is a flowchart for explaining the PCR detection process in step S22 of FIG.

ステップS41において、PCR検出部14は、パケット数のカウントに用いるカウント値nを、初期値としての、例えば、0にセットし、処理はステップS42に進む。   In step S41, the PCR detection unit 14 sets the count value n used for counting the number of packets as an initial value, for example, 0, and the process proceeds to step S42.

ステップS42において、PCR検出部14は、先頭のTSパケットを解析し、処理はステップS43に進む。   In step S42, the PCR detection unit 14 analyzes the first TS packet, and the process proceeds to step S43.

ステップS43において、PCR検出部14は、ステップS42で解析したTSパケットのPIDが、PCRが埋め込まれているTSパケットであることを表すPCR_PIDであるか否かを判定する。   In step S43, the PCR detection unit 14 determines whether or not the PID of the TS packet analyzed in step S42 is a PCR_PID indicating that the PCR packet is an embedded TS packet.

ステップS43において、PCR検出部14が、TSパケットのPIDがPCR_PIDであると判定した場合、処理はステップS44に進み、一方、TSパケットのPIDがPCR_PIDでないと判定した場合、処理はステップS49に進む。   In step S43, if the PCR detection unit 14 determines that the PID of the TS packet is PCR_PID, the process proceeds to step S44. If the PID of the TS packet is not PCR_PID, the process proceeds to step S49. .

ステップS44において、PCR検出部14は、ステップS42で解析したTSパケットに、処理の対象となっているMPEG2-TSに関する付加情報などが記述されているアダプテーションフィールド(adaptation_field)があるか否かを判定する。   In step S44, the PCR detection unit 14 determines whether or not the TS packet analyzed in step S42 has an adaptation field (adaptation_field) in which additional information regarding the MPEG2-TS to be processed is described. To do.

ステップS44において、PCR検出部14が、TSパケットにアダプテーションフィールドがあると判定した場合、処理はステップS45に進み、一方、TSパケットにアダプテーションフィールドがないと判定した場合、処理はステップS49に進む。   If the PCR detection unit 14 determines in step S44 that the TS packet has an adaptation field, the process proceeds to step S45. On the other hand, if it is determined that the TS packet does not have an adaptation field, the process proceeds to step S49.

ステップS45において、PCR検出部14は、ステップS42で解析したTSパケットのアダプテーションの長さ(adaptation_field_length)が0であるか否かを判定する。   In step S45, the PCR detection unit 14 determines whether or not the adaptation length (adaptation_field_length) of the TS packet analyzed in step S42 is zero.

ステップS45において、PCR検出部14が、TSパケットのアダプテーションフィールドの長さが0でないと判定した場合、処理はステップS46に進み、一方、TSパケットのアダプテーションフィールドの長さが0であると判定した場合、処理はステップS49に進む。   In step S45, if the PCR detection unit 14 determines that the length of the adaptation field of the TS packet is not 0, the process proceeds to step S46, and on the other hand, determines that the length of the adaptation field of the TS packet is 0. If so, the process proceeds to step S49.

ステップS46において、PCR検出部14は、PCRが含まれているか否かを表すフラグ(PCR_flag)が、PCRが含まれていることを表す1であるか否かを判定する。   In step S46, the PCR detection unit 14 determines whether or not a flag (PCR_flag) indicating whether or not PCR is included is 1 indicating that PCR is included.

ステップS46において、PCR検出部14が、PCRが含まれているか否かを表すフラグが1であると判定した場合、処理はステップS47に進み、一方、PCRが含まれているか否かを表すフラグが1でないと判定した場合、処理はステップS49に進む。   In step S46, if the PCR detection unit 14 determines that the flag indicating whether or not PCR is included is 1, the process proceeds to step S47, while the flag indicating whether or not PCR is included. If it is determined that is not 1, the process proceeds to step S49.

ここで、処理がステップS47に進むとき、ステップS43乃至S46での判定により、処理の対象となっているTSパケットにPCRが埋め込まれていると判定されている。即ち、処理の対象となっているTSパケットが、PCRが埋め込まれているTSパケットであるとして検出されているので、ステップS47において、PCR検出部14は、TSパケットからPCR値を抽出し、処理はステップS48に進む。   Here, when the process proceeds to step S47, it is determined by the determination in steps S43 to S46 that the PCR is embedded in the TS packet to be processed. That is, since the TS packet to be processed is detected as a TS packet in which PCR is embedded, in step S47, the PCR detection unit 14 extracts a PCR value from the TS packet, and performs processing. Advances to step S48.

ステップS48において、PCR検出部14は、カウント値nを位置情報として取得し、カウント値をリセット、即ち、カウント値nに初期値としての0をセットする。ここで、後述するように、TSパケットにPCRが埋め込まれていない場合には、カウント値nをインクリメントして処理が繰り返されるので、TSパケットにPCRが埋め込まれていると判定されたときのカウント値は、PCRが含まれているTSパケットの位置を示す位置情報(即ち、パケット数)となる。   In step S48, the PCR detection unit 14 acquires the count value n as position information, resets the count value, that is, sets 0 as an initial value to the count value n. Here, as will be described later, when the PCR is not embedded in the TS packet, the count value n is incremented and the process is repeated, so that the count when it is determined that the PCR is embedded in the TS packet is counted. The value is position information (that is, the number of packets) indicating the position of the TS packet including the PCR.

ステップS49において、PCR検出部14は、カウント値nを1だけインクリメントする。   In step S49, the PCR detection unit 14 increments the count value n by 1.

ステップS48またはS49の処理後、処理はステップS50に進み、PCR検出部14は、MPEG2-TSが終了したか否かを判定する。例えば、MPEG2-TSの先頭のTSパケットから順に処理の対象としている場合、最後尾のTSパケットが処理の対象とされたか否かを判定する。   After the process of step S48 or S49, the process proceeds to step S50, and the PCR detection unit 14 determines whether or not MPEG2-TS has ended. For example, when processing is performed in order from the first TS packet of MPEG2-TS, it is determined whether or not the last TS packet has been processed.

ステップS50において、PCR検出部14が、MPEG2-TSが終了していないと判定した場合、処理はステップS51に進む。   If the PCR detection unit 14 determines in step S50 that MPEG2-TS has not ended, the process proceeds to step S51.

ステップS51において、PCR検出部14は、現在処理の対象となったTSパケットの次のTSパケットを処理の対象とし、ステップS42に戻り、新たに処理の対象となったTSパケットに対して、以下、同様の処理が繰り返される。   In step S51, the PCR detection unit 14 sets the TS packet next to the currently processed TS packet as a processing target, returns to step S42, and applies the following processing to the newly processed TS packet. The same process is repeated.

一方、ステップS50において、PCR検出部14が、MPEG2-TSが終了したと判定した場合、処理は終了される。   On the other hand, if the PCR detection unit 14 determines in step S50 that MPEG2-TS has ended, the process ends.

次に、図5を参照して、時間間隔およびタイムスタンプ値を算出する処理について説明する。   Next, processing for calculating a time interval and a time stamp value will be described with reference to FIG.

図5には、処理の対象となるMPEG2-TSが示されており、MPEG2-TSは、複数のTSパケットが連続して構成されている。   FIG. 5 shows MPEG2-TS to be processed, and MPEG2-TS is composed of a plurality of TS packets continuously.

図5において、ハッチングが施されているTSパケットは、PCR検出部14においてPCRが検出されたTSパケットを表しており、それらのTSパケットの上側には、TSパケットからそれぞれ抽出されたPCR値が示されている。即ち、図5の例では、5つのTSパケットからPCRが抽出され、最初にPCRが検出されたTSパケットのPCR値はPCR1であり、2番目にPCRが検出されたTSパケットのPCR値はPCR2であり、以下同様に、最後にPCRが検出されたTSパケットのPCR値はPCR5である。 In FIG. 5, hatched TS packets represent TS packets for which PCR has been detected by the PCR detection unit 14, and PCR values extracted from the TS packets are above the TS packets, respectively. It is shown. That is, in the example of FIG. 5, PCR is extracted from five TS packets, the PCR value of the TS packet in which PCR is first detected is PCR 1 , and the PCR value of the TS packet in which PCR is detected second is a PCR 2, Similarly, PCR value of TS packet last PCR has been detected is PCR 5.

また、TSパケットの下側には、PCR検出部14において位置情報として取得されたパケット数が示されている。即ち、先頭のTSパケットからPCR値がPCR1であるTSパケットの直前のTSパケットまでのパケット数がN0であり、PCR値がPCR1であるTSパケットからPCR値がPCR2であるTSパケットの直前のTSパケットまでのパケット数がN1である。以下、同様に、PCR値がPCR5であるPCRが検出されたTSパケットから最後尾のTSパケットまでのパケット数がN5である。 The number of packets acquired as position information in the PCR detection unit 14 is shown below the TS packet. That is, the number of packets from the head of the TS packet to the TS packet immediately before the TS packet PCR value is PCR 1 is N 0, PCR values from the TS packet PCR value is PCR 1 is PCR 2 TS packets The number of packets up to the TS packet immediately before is N 1 . Hereinafter, similarly, the number of packets from a TS packet in which a PCR having a PCR value of PCR 5 is detected to the last TS packet is N 5 .

そして、時間間隔算出部15は、PCRが検出されたTSパケットにより区切られる処理ブロックごとに、隣り合うTSパケット同士の時間間隔を算出する処理を行う。図5の例では、処理ブロックU1乃至U4ごとに処理が行われる。 Then, the time interval calculation unit 15 performs a process of calculating a time interval between adjacent TS packets for each processing block delimited by the TS packets in which PCR is detected. In the example of FIG. 5, processing is performed for each of the processing blocks U 1 to U 4 .

例えば、先頭の処理ブロックU1には、先頭のTSパケットからPCR値がPCR1であるTSパケットの直前のTSパケットまでのTSパケット、および、PCR値がPCR1であるTSパケットからPCR値がPCR2であるTSパケットの直前のTSパケットまでのTSパケットが含まれている。即ち、先頭のTSパケットからPCR値がPCR1であるTSパケットの直前のTSパケットまでにおいて、時間間隔データは、PCR値がPCR1であるTSパケットからPCR値がPCR2であるTSパケットの直前のTSパケットまでのTSパケットにおける時間間隔データと同様に、PCR1とPCR2を用いて求められる。 For example, in the first processing block U 1 , the TS packet from the first TS packet to the TS packet immediately before the TS packet whose PCR value is PCR 1 and the PCR value from the TS packet whose PCR value is PCR 1 are included. TS packets up to the TS packet immediately before the TS packet of PCR 2 are included. That is, from the first TS packet to the TS packet immediately before the TS packet with the PCR value of PCR 1 , the time interval data is from the TS packet with the PCR value of PCR 1 immediately before the TS packet with the PCR value of PCR 2. Similar to the time interval data in the TS packet up to the TS packet, the PCR 1 and PCR 2 are used.

また、処理ブロックU2には、PCR値がPCR2であるTSパケットから、PCR値がPCR3であるTSパケットの直前のTSパケットまでのTSパケットが含まれており、処理ブロックU3には、PCR値がPCR3であるTSパケットから、PCR値がPCR4であるTSパケットの直前のTSパケットまでのTSパケットが含まれている。即ち、PCRが検出されたTSパケット間において、時間間隔データは、その前後のTSパケットのPCR値を用いて求められる。 The processing block U 2 includes TS packets from a TS packet having a PCR value of PCR 2 to a TS packet immediately before the TS packet having a PCR value of PCR 3 , and the processing block U 3 includes TS packets from a TS packet with a PCR value of PCR 3 to a TS packet immediately before the TS packet with a PCR value of PCR 4 are included. That is, between the TS packets in which PCR is detected, the time interval data is obtained using the PCR values of the TS packets before and after that.

また、最後尾の処理ブロックU4には、PCR値がPCR4であるTSパケットから、PCR値がPCR5であるTSパケットの直前のTSパケットまでのTSパケット、および、PCR5であるTSパケットから、最後尾のTSパケットまでのTSパケットが含まれている。即ち、PCR5であるTSパケットから、最後尾のTSパケットまでのTSパケットにおいて、時間間隔データは、PCR値がPCR4であるTSパケットから、PCR値がPCR5であるTSパケットの直前のTSパケットまでのTSパケットにおける時間間隔データと同様に、PCR4とPCR5を用いて求められる。 In addition, the end of the processing block U 4, the TS packet PCR value is PCR 4, TS packets up TS packet immediately before the TS packet PCR value is PCR 5, and, TS packet is PCR 5 To the last TS packet are included. That is, in the TS packet from the TS packet with PCR 5 to the last TS packet, the time interval data is the TS immediately before the TS packet with PCR value PCR 5 from the TS packet with PCR value PCR 4. Similar to the time interval data in the TS packet up to the packet, it is obtained using PCR 4 and PCR 5 .

上述したように、PCR検出部14により、PCR値とパケット数とが取得され、時間間隔算出部15が、PCR値とパケット数に基づいて、時間間隔データを取得する。   As described above, the PCR detection unit 14 acquires the PCR value and the number of packets, and the time interval calculation unit 15 acquires time interval data based on the PCR value and the number of packets.

n番目の処理ブロックUn(図5の例では、n=1〜4)において、隣り合うTSパケット同士の時間間隔(整数値)をQnとすると、時間間隔Qnは、次の式(1)で表される。 In the n-th processing block U n (n = 1 to 4 in the example of FIG. 5), if the time interval (integer value) between adjacent TS packets is Q n , the time interval Q n is expressed by the following equation ( 1).

n=(PCRn+1−PCRn)/Nn
・・・(1)
Q n = (PCR n + 1 −PCR n ) / N n
... (1)

ただし、Nnは、n番目の処理ブロックUnのパケット数である。また、処理ブロックUnにおいて、隣り合うTSパケット同士の時間間隔Qnの余剰をRnとすると、余剰Rnは、次の式(2)で表される。 Here, N n is the number of packets of the nth processing block Un. Further, the processing block U n, the excess time interval Q n between adjacent TS packets When R n, excess R n is expressed by the following equation (2).

n=(PCRn+1−PCRn)modNn
・・・(2)
R n = (PCR n + 1 −PCR n ) modN n
... (2)

ただし、式(2)において、modは、(PCRn+1−PCRn)をパケット数Nnで除算し、その演算結果として余剰を返す演算子である。 However, in equation (2), mod is an operator that divides (PCR n + 1 −PCR n ) by the number of packets N n and returns a surplus as the result of the operation.

ここで、処理ブロックUnのm番目のTSパケットのタイムスタンプ値をVn[m]とする。 Here, the time stamp value of the m-th TS packet of the processing block U n is assumed to be V n [m] .

まず、1番目の処理ブロックU1の先頭のTSパケットについてのタイムスタンプ値V1[1]は、任意の値に設定される。なお、1番目の処理ブロックU1における時間間隔Q1は、(PCR2−PCR1)/N1であり、処理ブロックU1における余剰R1は、(PCR2−PCR1)modN1である。 First, the time stamp value V 1 [1] for the first TS packet of the first processing block U 1 is set to an arbitrary value. The time interval Q 1 in the first processing block U 1 is (PCR 2 -PCR 1) / N 1, excess of R 1 in the processing block U 1 is the (PCR 2 -PCR 1) modN 1 .

そして、2番目の処理ブロックU2の先頭のTSパケットについてのタイムスタンプ値V2[1]は、次の式(3)で表される。 The time stamp value V 2 [1] for the first TS packet of the second processing block U 2 is expressed by the following equation (3).

2[1]=V1[1]+Q1(N0+N1)+(R1(N0+N1)+C1[1])/N1
=V1[1]+((PCR2−PCR1)×(N0+N1)+C1[1])/N1
・・・(3)
V 2 [1] = V 1 [1] + Q 1 (N 0 + N 1) + (R 1 (N 0 + N 1) + C 1 [1]) / N 1
= V 1 [1] + ( (PCR 2 -PCR 1) × (N 0 + N 1) + C 1 [1]) / N 1
... (3)

ただし、式(3)においてC1[1]は、処理ブロックU1の先頭のTSパケットについてのタイムスタンプ値V1[1]のキャリーオーバを表し、次の式(4)で表される。 However, in equation (3), C 1 [1] represents the carry-over of the time stamp value V 1 [1] for the first TS packet of the processing block U 1 and is represented by the following equation (4).

1[1]=(−R1×N0)modN1
・・・(4)
C 1 [1] = (− R 1 × N 0 ) modN 1
... (4)

なお、処理ブロックU2以降において、各処理ブロックUn(n≧2)の先頭のTSパケットについてのタイムスタンプ値Vn[1]のキャリーオーバCn[1]は、0である。また、2番目の処理ブロックU2における時間間隔Q2は、(PCR3−PCR2)/N2であり、処理ブロックU2における余剰R2は、(PCR3−PCR2)modN2である。 In the processing block U 2 and later, the carryover C n [1] of the time stamp value V n [1] for the first TS packet of each processing block U n (n ≧ 2) is zero. The time interval Q 2 in the second processing block U 2 is (PCR 3 -PCR 2) / N 2, the excess R 2 in the processing block U 2 is a (PCR 3 -PCR 2) modN 2 .

そして、3番目以降の処理ブロックUn(n≧3)の先頭のTSパケットについてのタイムスタンプ値Vn[1]は、次の式(5)で表される。 The time stamp value V n [1] for the first TS packet of the third and subsequent processing blocks U n (n ≧ 3) is expressed by the following equation (5).

n[1]=Vn-1[1]+(PCRn−PCRn-1
・・・(5)
V n [1] = V n -1 [1] + (PCR n -PCR n-1)
... (5)

時間間隔算出部15は、式(1)乃至式(5)を演算することにより、処理ブロックUnにおける時間間隔Qn、時間間隔Qnの余剰Rn、および処理ブロックUnの先頭のTSパケットのタイムスタンプ値Vn[1]を算出する。そして、時間間隔算出部15は、時間間隔Qn、余剰Rn、およびタイムスタンプ値Vn[1]を、時間間隔データとして取得し、タイムスタンプ算出部16に供給する。 Time interval calculating unit 15, by calculating equation (1) to (5), the time interval Q n in the processing block U n, the first TS surplus R n, and the processing block U n time intervals Q n The time stamp value V n [1] of the packet is calculated. Then, the time interval calculation unit 15 acquires the time interval Q n , the surplus R n , and the time stamp value V n [1] as time interval data, and supplies the time interval data to the time stamp calculation unit 16.

次に、処理ブロックUnのm番目のTSパケットのタイムスタンプ値Vn[m]は、(Cn[m-1]+Rn)≧Nnであるとき、次の式(6)で表され、(Cn[m-1]+Rn)<Nnであるとき、次の式(7)で表される。 Next, the time stamp value V n [m] of the m-th TS packet of the processing block U n is expressed by the following equation (6) when (C n [m−1] + R n ) ≧ N n. When (C n [m−1] + R n ) <N n, it is expressed by the following formula (7).

n[m]=Vn[m-1]+Qn+1
・・・(6)
n[m]=Vn[m-1]+Qn
・・・(7)
V n [m] = V n [m-1] + Q n +1
... (6)
V n [m] = V n [m-1] + Q n
... (7)

また、処理ブロックUnのm番目のTSパケットについてのタイムスタンプ値Vn[m]のキャリーオーバCn[m]は、(Cn[m-1]+Rn)≧Nnであるとき、次の式(8)で表され、(Cn[m-1]+Rn)<Nnであるとき、次の式(9)で表される。 The carryover C n [m] of the time stamp value V n [m] for the m-th TS packet in the processing block U n is (C n [m−1] + Rn) ≧ N n When (C n [m−1] + R n ) <N n, it is represented by the following formula (9).

n[m]=Cn[m-1]+Rn−Nn
・・・(8)
n[m]=Cn[m-1]+Rn
・・・(9)
C n [m] = C n [m-1] + R n -N n
... (8)
C n [m] = C n [m-1] + R n
... (9)

ただし、式(6)乃至式(9)において、m>2である。   However, in Formula (6) thru | or Formula (9), it is m> 2.

タイムスタンプ算出部16は、時間間隔算出部15から時間間隔データとして供給される時間間隔Qn、余剰Rn、およびタイムスタンプ値Vn[1]を用いて、式(6)乃至式(9)を演算することにより、タイムスタンプ値Vn[m]を算出し、処理ブロックUnのm番目のTSパケットに付加する。 The time stamp calculation unit 16 uses the time interval Q n , the surplus R n , and the time stamp value V n [1] supplied as time interval data from the time interval calculation unit 15, and uses Equations (6) to (9). ) Is calculated, and the time stamp value V n [m] is calculated and added to the m-th TS packet of the processing block U n .

ここで、例えば、キャリーオーバCn[m]を考慮せずに、時間間隔Qnを単に加算することによりタイムスタンプ値を算出する場合には、余剰が積み重なることにより、PCR値とタイムスタンプ値とのズレが大きくなる。これに対し、キャリーオーバCn[m]を考慮することにより、このズレを最小にすることができる。 Here, for example, when the time stamp value is calculated by simply adding the time interval Q n without considering the carryover C n [m] , the PCR value and the time stamp value are obtained by stacking the surplus. The gap with the will increase. On the other hand, this shift can be minimized by considering the carry-over C n [m] .

即ち、キャリーオーバCn[m]がパケット数Nnより大となるときには、タイムスタンプ値Vn[m]が、キャリーオーバCn[m]がパケット数Nn未満であるときよりも、1だけ多くなるようにするとともに、キャリーオーバCn[m]からパケット数Nnを減算することで、PCR値とタイムスタンプ値とのズレが、1以上に大きくなることが回避され、タイムスタンプを均等に割り付けることができる。 That is, when the carryover C n [m] is larger than the number of packets N n , the time stamp value V n [m] is 1 than when the carry over C n [m] is less than the number of packets N n. The difference between the PCR value and the time stamp value is avoided to be larger than 1 by subtracting the number of packets N n from the carryover C n [m] , and the time stamp is reduced. Can be allocated evenly.

また、式(6)乃至式(9)に示すように、タイムスタンプ算出部16が行う処理は、キャリーオーバと時間間隔とを比較して、直前のタイムスタンプ値に時間間隔を加算し、新たなキャリーオーバを算出するだけの処理である。従って、タイムスタンプ算出部16をハードウェアで実現すると、その回路は、例えば、除算などを行う必要がある処理を実行する回路などに比べて、ステップ数を少なくし、非常に小さなハードウェアで構成することができるとともに、高速でタイムスタンプを付加することができる。   Further, as shown in the equations (6) to (9), the processing performed by the time stamp calculation unit 16 compares the carry over with the time interval, adds the time interval to the immediately preceding time stamp value, and creates a new one. This is a process that simply calculates a carryover. Therefore, when the time stamp calculation unit 16 is realized by hardware, the circuit is configured with very small hardware, for example, by reducing the number of steps compared to a circuit that executes processing that needs to perform division or the like. And a time stamp can be added at high speed.

即ち、タイムスタンプ算出部16をハードウェアで実現し、CPU13が、ソフトウェアを実行することにより、時間間隔算出部15の機能を実現することで、時間間隔や、その余剰などを算出する処理は、CPU13で行い、キャリーオーバと時間間隔とを比較して、直前のタイムスタンプ値に時間間隔を加算し、新たなキャリーオーバを算出する処理は、タイムスタンプ算出部16で行うというように、ハードウェアとソフトウェアとで、効率よく処理を分担して行うことができる。   In other words, the time stamp calculation unit 16 is realized by hardware, and the CPU 13 executes the software to realize the function of the time interval calculation unit 15, thereby calculating the time interval and the surplus thereof. The processing that is performed by the CPU 13 and compares the carry-over with the time interval, adds the time interval to the previous time stamp value, and calculates a new carry-over is performed by the time stamp calculation unit 16. And software can efficiently share the processing.

また、タイムスタンプ算出部16をハードウェアで実現することで、CPUにかかる負担が大きくなることを回避することができ、例えば、ハードディスクレコーダなどの組み込み機器に搭載されている処理能力の低いCPUでも、処理に占有されることを回避することができるので、高性能なCPUを搭載してタイムスタンプを付加する処理の負担が大きくなることを解決する場合に比べて、コストを低減させることができる。   In addition, by realizing the time stamp calculation unit 16 with hardware, it is possible to avoid an increase in the burden on the CPU. For example, even a CPU with low processing capability mounted in an embedded device such as a hard disk recorder can be avoided. Because it can avoid being occupied by processing, the cost can be reduced compared with the case where the burden of processing to add a time stamp is increased by installing a high-performance CPU. .

なお、本実施の形態では、CPU13が、メモリ12からMPEG2-TSを読み出してPCR検出部14供給するとしたが、例えば、CPU13が、MPEG2-TSが記憶されているメモリ12のアドレスをタイムスタンプ算出部16に供給し、タイムスタンプ算出部16がメモリ12からMPEG2-TSを読み出すとともに、タイムスタンプを付加したMPEG2-TSをメモリ12に書き込むDMA(Direct Memory Access)により処理を行うようにしてもよい。DMAにより処理を行うことで、より高速にタイムスタンプを付加する処理を行うことができる。   In this embodiment, the CPU 13 reads the MPEG2-TS from the memory 12 and supplies it to the PCR detection unit 14. However, for example, the CPU 13 calculates the time stamp of the address of the memory 12 where the MPEG2-TS is stored. The time stamp calculating unit 16 may read the MPEG2-TS from the memory 12 and perform processing by DMA (Direct Memory Access) that writes the MPEG2-TS with the time stamp added to the memory 12. . By performing processing by DMA, processing for adding a time stamp can be performed at higher speed.

また、PCRが検出されたTSパケットの位置情報としては、上述したようなPCRが検出されたTSパケット間のパケット数などの他、PCRが検出されたTSパケットの先頭からのバイト数や、先頭からのパケット数などを用いることができる。   The location information of the TS packet in which PCR is detected includes the number of bytes between TS packets in which PCR is detected as described above, the number of bytes from the beginning of the TS packet in which PCR is detected, The number of packets from can be used.

なお、PCRが検出されたTSパケットの位置情報として用いられる、最後にPCRが検出されたTSパケットから最後尾のTSパケットまでのパケット数は、PCR検出部14からCPU13に供給しなくてもよい。即ち、CPU13にとって、ストリーム長が既知であるので、CPU13は、ストリーム長から、最後にPCRが検出されたTSパケットから最後尾のTSパケットまでのパケット数を取得することができる。   The number of packets from the last TS packet from which the PCR was detected to the last TS packet used as position information of the TS packet from which the PCR was detected need not be supplied from the PCR detection unit 14 to the CPU 13. . That is, since the stream length is known to the CPU 13, the CPU 13 can acquire the number of packets from the TS packet in which PCR was detected last to the last TS packet from the stream length.

なお、PCR検出部14は、PCR検出完了通知とともにPCR値と位置情報とをCPU13に供給する他、例えば、PCRを検出するたびに、PCR値と位置情報をCPU13に供給してもよい。   The PCR detection unit 14 may supply the PCR value and the position information to the CPU 13 every time a PCR is detected, in addition to supplying the PCR value and the position information to the CPU 13 together with the PCR detection completion notification.

なお、上述した実施の形態では、時間間隔算出部15の機能は、CPU13がソフトウェアを実行することにより実現し、PCR検出部14やタイムスタンプ算出部16の機能は、それぞれハードウェアにより実行するとしたが、PCR検出部14やタイムスタンプ算出部16の機能も、CPU13がソフトウェアを実行することにより実現することができる。   In the above-described embodiment, the function of the time interval calculation unit 15 is realized by the CPU 13 executing software, and the functions of the PCR detection unit 14 and the time stamp calculation unit 16 are each executed by hardware. However, the functions of the PCR detection unit 14 and the time stamp calculation unit 16 can also be realized by the CPU 13 executing software.

一連の処理をソフトウェアにより実行する場合には、そのソフトウェアを構成するプログラムが、専用のハードウェアに組み込まれているコンピュータ、または、各種のプログラムをインストールすることで、各種の機能を実行することが可能な、例えば汎用のパーソナルコンピュータなどに、プログラム記録媒体からインストールされる。   When a series of processing is executed by software, a program constituting the software may execute various functions by installing a computer incorporated in dedicated hardware or various programs. For example, it is installed from a program recording medium in a general-purpose personal computer or the like.

図6は、上述した一連の処理をプログラムにより実行するコンピュータのハードウェアの構成例を示すブロック図である。   FIG. 6 is a block diagram illustrating a hardware configuration example of a computer that executes the above-described series of processing by a program.

コンピュータにおいて、CPU(Central Processing Unit)101,ROM(Read Only Memory)102,RAM(Random Access Memory)103は、バス104により相互に接続されている。   In a computer, a CPU (Central Processing Unit) 101, a ROM (Read Only Memory) 102, and a RAM (Random Access Memory) 103 are connected to each other via a bus 104.

バス104には、さらに、入出力インタフェース105が接続されている。入出力インタフェース105には、キーボード、マウス、マイクロホンなどよりなる入力部106、ディスプレイ、スピーカなどよりなる出力部107、ハードディスクや不揮発性のメモリなどよりなる記憶部108、ネットワークインタフェースなどよりなる通信部109、磁気ディスク、光ディスク、光磁気ディスク、或いは半導体メモリなどのリムーバブルメディア111を駆動するドライブ110が接続されている。   An input / output interface 105 is further connected to the bus 104. The input / output interface 105 includes an input unit 106 including a keyboard, a mouse, and a microphone, an output unit 107 including a display and a speaker, a storage unit 108 including a hard disk and nonvolatile memory, and a communication unit 109 including a network interface. A drive 110 for driving a removable medium 111 such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory is connected.

以上のように構成されるコンピュータでは、CPU101が、例えば、記憶部108に記憶されているプログラムを、入出力インタフェース105及びバス104を介して、RAM103にロードして実行することにより、上述した一連の処理が行われる。   In the computer configured as described above, the CPU 101 loads, for example, the program stored in the storage unit 108 to the RAM 103 via the input / output interface 105 and the bus 104 and executes the program. Is performed.

コンピュータ(CPU101)が実行するプログラムは、例えば、磁気ディスク(フレキシブルディスクを含む)、光ディスク(CD-ROM(Compact Disc-Read Only Memory),DVD(Digital Versatile Disc)等)、光磁気ディスク、もしくは半導体メモリなどよりなるパッケージメディアであるリムーバブルメディア111に記録して、あるいは、ローカルエリアネットワーク、インタネット、デジタル衛星放送といった、有線または無線の伝送媒体を介して提供される。   The program executed by the computer (CPU 101) is, for example, a magnetic disk (including a flexible disk), an optical disk (CD-ROM (Compact Disc-Read Only Memory), DVD (Digital Versatile Disc), etc.), a magneto-optical disk, or a semiconductor. The program is recorded on a removable medium 111 that is a package medium including a memory or the like, or is provided via a wired or wireless transmission medium such as a local area network, the Internet, or digital satellite broadcasting.

そして、プログラムは、リムーバブルメディア111をドライブ110に装着することにより、入出力インタフェース105を介して、記憶部108にインストールすることができる。また、プログラムは、有線または無線の伝送媒体を介して、通信部109で受信し、記憶部108にインストールすることができる。その他、プログラムは、ROM102や記憶部108に、あらかじめインストールしておくことができる。   The program can be installed in the storage unit 108 via the input / output interface 105 by attaching the removable medium 111 to the drive 110. Further, the program can be received by the communication unit 109 via a wired or wireless transmission medium and installed in the storage unit 108. In addition, the program can be installed in the ROM 102 or the storage unit 108 in advance.

また、上述のフローチャートを参照して説明した各処理は、必ずしもフローチャートとして記載された順序に沿って時系列に処理する必要はなく、並列的あるいは個別に実行される処理(例えば、並列処理あるいはオブジェクトによる処理)も含むものである。また、プログラムは、1のCPUにより処理されるものであっても良いし、複数のCPUによって分散処理されるものであっても良い。   In addition, the processes described with reference to the flowcharts described above do not necessarily have to be processed in time series in the order described in the flowcharts, but are performed in parallel or individually (for example, parallel processes or objects). Processing). The program may be processed by one CPU, or may be distributedly processed by a plurality of CPUs.

なお、本発明の実施の形態は、上述した実施の形態に限定されるものではなく、本発明の要旨を逸脱しない範囲において種々の変更が可能である。   The embodiment of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the gist of the present invention.

本発明を適用したタイムスタンプ付加装置の一実施の形態の構成例を示すブロック図である。It is a block diagram which shows the structural example of one Embodiment of the time stamp addition apparatus to which this invention is applied. MPEG2-TSの構成例を示す図である。It is a figure which shows the structural example of MPEG2-TS. タイムスタンプ付加装置11が、MPEG2-TSにタイムスタンプを付加する処理を説明するフローチャートである。10 is a flowchart for explaining processing of adding a time stamp to the MPEG2-TS by the time stamp adding device 11; PCR検出処理を説明するフローチャートである。It is a flowchart explaining a PCR detection process. 時間間隔およびタイムスタンプ値を算出する処理について説明する図である。It is a figure explaining the process which calculates a time interval and a time stamp value. 本発明を適用したコンピュータの一実施の形態の構成例を示すブロック図である。It is a block diagram which shows the structural example of one Embodiment of the computer to which this invention is applied.

符号の説明Explanation of symbols

11 タイムスタンプ付加装置, 12 メモリ, 13 CPU, 14 PCR検出部, 15 時間間隔算出部, 16 タイムスタンプ算出部, 17 システムバス   11 Time stamp adding device, 12 memory, 13 CPU, 14 PCR detecting unit, 15 time interval calculating unit, 16 time stamp calculating unit, 17 system bus

Claims (11)

MPEG2-TS(Moving Picture Experts Group 2 Transport Stream)に含まれる複数のTS(Transport Stream)パケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加装置において、
複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCR(Program Clock Reference)が埋め込まれており、前記PCRが埋め込まれているTSパケットを検出する検出手段と、
前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出する時間間隔算出手段と、
前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加するタイムスタンプ算出手段と
を備えるタイムスタンプ付加装置。
In a time stamp adding apparatus that adds a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS (Transport Stream) packets included in MPEG2-TS (Moving Picture Experts Group 2 Transport Stream) ,
Detection means for detecting a TS packet in which the PCR is embedded, in a predetermined TS packet of the plurality of TS packets, embedded with a PCR (Program Clock Reference) based on a predetermined system clock frequency When,
Based on the TS packet in which the PCR is embedded, a time interval calculating means for calculating an input timing interval between adjacent TS packets;
Time stamp addition comprising: time stamp calculation means for calculating the input timing of the TS packet based on the input timing interval between the TS packets, and adding a time stamp representing the input timing to each of the plurality of TS packets. apparatus.
複数の前記TSパケットには、それぞれを識別するPID(Packet Identifier)が含まれており、
前記MPEG2-TSに含まれる所定のTSパケットには、前記TSパケットのPIDのリストが記述されているPMT(Program Map Table)を伝送するTSパケットのPIDを示すPAT(Program Association Table)が含まれており、
前記検出手段は、
前記PATを解析して、前記PMTを伝送するTSパケットのPIDを検出し、
前記PMTを伝送するTSパケットのPIDにより識別されるTSパケットのPMTを解析して、前記PCRが埋め込まれているTSパケットのPIDを検出し、
前記PCRが埋め込まれているTSパケットのPIDに基づいて、前記PCRが埋め込まれているTSパケットを検出する
請求項1に記載のタイムスタンプ付加装置。
Each of the plurality of TS packets includes a PID (Packet Identifier) for identifying each of the TS packets,
The predetermined TS packet included in the MPEG2-TS includes a PAT (Program Association Table) indicating a PID of a TS packet that transmits a PMT (Program Map Table) in which a list of PIDs of the TS packet is described. And
The detection means includes
Analyzing the PAT, detecting the PID of the TS packet that transmits the PMT,
Analyzing the PMT of the TS packet identified by the PID of the TS packet that transmits the PMT, and detecting the PID of the TS packet in which the PCR is embedded,
The time stamp addition apparatus according to claim 1, wherein the TS packet in which the PCR is embedded is detected based on a PID of the TS packet in which the PCR is embedded.
複数の前記TSパケットには、それぞれを識別するPID(Packet Identifier)が含まれており、
前記TSパケットのPIDのリストが記述されているPMT(Program Map Table)を伝送するTSパケットのPID、または、前記PCRが埋め込まれているTSパケットのPIDを記憶する記憶手段
をさらに備え、
前記検出手段は、
前記記憶手段に記憶されている前記PMTを伝送するTSパケットのPIDにより識別されるTSパケットのPMTを解析して、前記PCRが埋め込まれているTSパケットのPIDを検出し、前記PCRが埋め込まれているTSパケットのPIDに基づいて、前記PCRが埋め込まれているTSパケットを検出し、
または、前記記憶手段に記憶されている前記PCRが埋め込まれているTSパケットのPIDに基づいて、前記PCRが埋め込まれているTSパケットを検出する
請求項1に記載のタイムスタンプ付加装置。
Each of the plurality of TS packets includes a PID (Packet Identifier) for identifying each of the TS packets,
A storage means for storing a PID of a TS packet that transmits a PMT (Program Map Table) in which a list of PIDs of the TS packet is described, or a PID of a TS packet in which the PCR is embedded;
The detection means includes
Analyzing the PMT of the TS packet identified by the PID of the TS packet that transmits the PMT stored in the storage means, detects the PID of the TS packet in which the PCR is embedded, and the PCR is embedded Based on the PID of the TS packet, the TS packet in which the PCR is embedded is detected,
The time stamp addition apparatus according to claim 1, wherein the TS packet in which the PCR is embedded is detected based on a PID of the TS packet in which the PCR is embedded, which is stored in the storage unit.
前記検出手段は、
前記PCRが埋め込まれているTSパケットのデータ構造に基づいて、前記TSパケットの所定の箇所から、前記PCRの値を抽出するPCR値抽出手段と、
前記PCRが埋め込まれているTSパケットのMPEG2-TS中における位置を表す位置情報を取得する位置情報取得手段と
を有し、
前記PCR値抽出手段が抽出したPCRの値と、前記位置情報取得手段が取得した位置情報とを、前記時間間隔算出手段に供給する
請求項1に記載のタイムスタンプ付加装置。
The detection means includes
Based on the data structure of the TS packet in which the PCR is embedded, PCR value extraction means for extracting the PCR value from a predetermined location of the TS packet;
Position information acquisition means for acquiring position information indicating the position in the MPEG2-TS of the TS packet in which the PCR is embedded;
The time stamp addition apparatus according to claim 1, wherein the PCR value extracted by the PCR value extraction unit and the position information acquired by the position information acquisition unit are supplied to the time interval calculation unit.
前記位置情報取得手段は、
先頭のTSパケットから、最初に前記PCRが含まれているTSパケットの直前のTSパケットまでのパケット数と、
前記PCRが含まれているTSパケットの次に前記PCRが含まれているTSパケットの直前のTSパケットまでのパケット数と、
最後に前記PCRが含まれているTSパケットから、最後尾のTSパケットまでのパケット数と
を前記位置情報として取得する
請求項4に記載の検出装置。
The position information acquisition means includes
The number of packets from the first TS packet to the first TS packet immediately before the TS packet containing the PCR,
The number of packets from the TS packet containing the PCR to the TS packet immediately before the TS packet containing the PCR,
The detection apparatus according to claim 4, wherein the number of packets from the last TS packet including the PCR to the last TS packet is acquired as the position information.
前記位置情報取得手段は、前記PCRが含まれているTSパケットの前記MPEG2-TSの先頭からのバイト数またはパケット数を、前記位置情報として取得する
請求項4に記載の検出装置。
The detection apparatus according to claim 4, wherein the position information acquisition unit acquires the number of bytes or the number of packets from the head of the MPEG2-TS of a TS packet including the PCR as the position information.
前記時間間隔算出手段には、前記検出手段から、前記PCR値抽出手段が抽出したPCRの値と、前記位置情報取得手段が取得した位置情報とが供給され、
前記時間間隔算出手段は、前記PCRの値と前記位置情報とを用いて、
前記PCRが含まれている2つのTSパケット間における前記入力タイミングの間隔を、前記2つのTSパケットから抽出されたPCRの値に基づいて算出し、
先頭のTSパケットから、最初に前記PCRが含まれているTSパケットまでの間における前記入力タイミングの間隔を、最初に前記PCRが含まれているTSパケットから抽出されたPCRの値と、最初に前記PCRが含まれているTSパケットの次の前記PCRが含まれているTSパケットから抽出されたPCRの値とに基づいて算出し、
最後に前記PCRが含まれているTSパケットから、最後尾のTSパケットまでにおける前記入力タイミングの間隔を、最後に前記PCRが含まれているTSパケットから抽出されたPCRの値と、最後に前記PCRが含まれているTSパケットの前の前記PCRが含まれているTSパケットから抽出されたPCRの値とに基づいて算出する
請求項4に記載の検出装置。
The time interval calculation means is supplied with the PCR value extracted by the PCR value extraction means and the position information acquired by the position information acquisition means from the detection means,
The time interval calculation means uses the PCR value and the position information,
An interval of the input timing between two TS packets including the PCR is calculated based on a PCR value extracted from the two TS packets,
The interval of the input timing from the first TS packet to the first TS packet including the PCR is set to the PCR value first extracted from the TS packet including the PCR. Calculated based on the value of PCR extracted from the TS packet containing the PCR next to the TS packet containing the PCR,
Finally, the input timing interval from the TS packet containing the PCR to the last TS packet, the PCR value extracted from the TS packet containing the PCR at the end, and finally the The detection device according to claim 4, wherein the detection device calculates based on a PCR value extracted from the TS packet including the PCR before the TS packet including the PCR.
前記タイムスタンプ算出手段は、前記時間間隔算出手段から供給される前記入力タイミングの間隔と、前記時間間隔算出手段が前記入力タイミングの間隔を算出する際に生じる余剰の積算値であるキャリーオーバとを用いて、前記TSパケットの入力タイミングを算出する
請求項7に記載の検出装置。
The time stamp calculating means includes the input timing interval supplied from the time interval calculating means, and a carry-over that is a surplus integrated value generated when the time interval calculating means calculates the input timing interval. The detection apparatus according to claim 7, wherein the input timing of the TS packet is calculated.
前記タイムスタンプ算出手段は、ハードウェアによりに実現され、前記時間間隔算出手段は、CPU(Central Processing Unit)がソフトウェアを実行することにより実現されている
請求項1に記載の検出装置。
The detection device according to claim 1, wherein the time stamp calculation unit is realized by hardware, and the time interval calculation unit is realized by a CPU (Central Processing Unit) executing software.
MPEG2-TS(Moving Picture Experts Group 2 Transport Stream)に含まれる複数のTS(Transport Stream)パケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加するタイムスタンプ付加方法において、
複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCR(Program Clock Reference)が埋め込まれており、前記PCRが埋め込まれているTSパケットを検出し、
前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出し、
前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加する
ステップを含むタイムスタンプ付加方法。
In a time stamp addition method for adding a time stamp indicating an input timing to a decoder that decodes the MPEG2-TS to a plurality of TS (Transport Stream) packets included in MPEG2-TS (Moving Picture Experts Group 2 Transport Stream) ,
PCR (Program Clock Reference) based on a predetermined system clock frequency is embedded in a predetermined TS packet among the plurality of TS packets, and detects the TS packet in which the PCR is embedded,
Based on the TS packet in which the PCR is embedded, calculate the input timing interval between adjacent TS packets,
A time stamp adding method including a step of calculating an input timing of the TS packet based on an input timing interval between the TS packets, and adding a time stamp indicating the input timing to each of the plurality of TS packets.
MPEG2-TS(Moving Picture Experts Group 2 Transport Stream)に含まれる複数のTSパケットに、前記MPEG2-TSをデコードするデコーダへの入力タイミングを表すタイムスタンプをそれぞれ付加する処理をコンピュータに実行させるプログラムにおいて、
複数の前記TSパケットのうちの所定のTSパケットには、所定のシステムクロック周波数を基準としたPCR(Program Clock Reference)が埋め込まれており、前記PCRが埋め込まれているTSパケットを検出し、
前記PCRが埋め込まれているTSパケットに基づいて、隣り合うTSパケット同士の入力タイミングの間隔を算出し、
前記TSパケット同士の入力タイミングの間隔に基づいて、前記TSパケットの入力タイミングを算出し、前記入力タイミングを表すタイムスタンプを複数の前記TSパケットにそれぞれ付加する
ステップを含む処理をコンピュータに実行させるプログラム。
In a program for causing a computer to execute a process of adding a time stamp indicating an input timing to a decoder for decoding the MPEG2-TS to a plurality of TS packets included in MPEG2-TS (Moving Picture Experts Group 2 Transport Stream),
PCR (Program Clock Reference) based on a predetermined system clock frequency is embedded in a predetermined TS packet among the plurality of TS packets, and detects the TS packet in which the PCR is embedded,
Based on the TS packet in which the PCR is embedded, calculate the input timing interval between adjacent TS packets,
A program for causing a computer to execute processing including a step of calculating an input timing of the TS packet based on an input timing interval between the TS packets and adding a time stamp representing the input timing to each of the plurality of TS packets. .
JP2007225205A 2007-08-31 2007-08-31 Time stamp addition device, time stamp addition method, and program Pending JP2009060324A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007225205A JP2009060324A (en) 2007-08-31 2007-08-31 Time stamp addition device, time stamp addition method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007225205A JP2009060324A (en) 2007-08-31 2007-08-31 Time stamp addition device, time stamp addition method, and program

Publications (1)

Publication Number Publication Date
JP2009060324A true JP2009060324A (en) 2009-03-19

Family

ID=40555664

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007225205A Pending JP2009060324A (en) 2007-08-31 2007-08-31 Time stamp addition device, time stamp addition method, and program

Country Status (1)

Country Link
JP (1) JP2009060324A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005063594A (en) * 2003-08-18 2005-03-10 Matsushita Electric Ind Co Ltd Data processing system
JP2005151463A (en) * 2003-11-19 2005-06-09 Pioneer Electronic Corp Device and method for receiving stream data

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005063594A (en) * 2003-08-18 2005-03-10 Matsushita Electric Ind Co Ltd Data processing system
JP2005151463A (en) * 2003-11-19 2005-06-09 Pioneer Electronic Corp Device and method for receiving stream data

Similar Documents

Publication Publication Date Title
JP4475336B2 (en) Time stamp adding apparatus, time stamp adding method, and program
JP7036962B2 (en) Playback method and playback device
US11849166B2 (en) Transmitting method, receiving method, transmitting device, and receiving device
EP2665261A1 (en) Content reproduction device, content reproduction method, delivery system, content reproduction program, recording medium, and data structure
US20060007958A1 (en) Multiplexing method and apparatus to generate transport stream
JP6617809B2 (en) Decoding device, decoding method, and decoding program
US20180295391A1 (en) Multiplexing apparatus, receiving apparatus, multiplexing method, and delay adjustment method
JP6753500B2 (en) Receiving device and decoding / presentation method
JP2010212996A (en) Information processing apparatus and multiplexing processing method
US20240064359A1 (en) Transmitting method, receiving method, transmitting device, and receiving device
JP6957186B2 (en) Information processing equipment, information processing methods, programs, and recording medium manufacturing methods
JP2010171919A (en) Video display apparatus
US9100672B2 (en) Data transmitting device and data transmitting and receiving system
JP2009060324A (en) Time stamp addition device, time stamp addition method, and program
JP2008153955A (en) Video recording and reproducing device, and its method for special reproduction
JP6684433B2 (en) Transmission device, transmission method, and program
JP4187040B2 (en) Recording / playback device
WO2016208417A1 (en) Data processing device, data processing method and program
JP2008236163A (en) Reproducing device, and video recording and reproducing device and special reproduction method thereof
JP2005341248A (en) Network type video transmitter and network type video receiver
JP2015159468A (en) Multiplexer, transmitter, transmission system, multiplexing method, transmission method
JP2005217556A (en) Program transmitting method, program transmitter, program transmitting system, and program transmitting program
JP2005167649A (en) Apparatus and method for storing and outputting a plurality of consecutive data
JP2004158921A (en) Data transmitter and data receiver

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100820

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120807

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120808

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20121204