summaryrefslogtreecommitdiffstats
path: root/libavcodec/dvdata.h
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2008-08-28 19:21:59 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2008-08-28 19:21:59 +0000
commitb4e0102c5caab49fcbf83bad0ba0635a940495db (patch)
tree4b7e99f9c72719432491f0171a94ab1353ba93ed /libavcodec/dvdata.h
parent452d3edb376fc205f8251e7c9ca443b6d881f24f (diff)
downloadffmpeg-streaming-b4e0102c5caab49fcbf83bad0ba0635a940495db.zip
ffmpeg-streaming-b4e0102c5caab49fcbf83bad0ba0635a940495db.tar.gz
Introducing video_stype for holding the value of VAUX source pack
and simplifying dv_frame_profile Originally committed as revision 15007 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dvdata.h')
-rw-r--r--libavcodec/dvdata.h38
1 files changed, 22 insertions, 16 deletions
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index 3949bb7..f12c4e3 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -38,6 +38,7 @@
*/
typedef struct DVprofile {
int dsf; /* value of the dsf in the DV header */
+ int video_stype; /* stype for VAUX source pack */
int frame_size; /* total size of one frame in bytes */
int difseg_size; /* number of DIF segments per DIF channel */
int n_difchan; /* number of DIF channels per frame */
@@ -2533,6 +2534,7 @@ static const uint8_t block_sizes_dv100[8] = {
static const DVprofile dv_profiles[] = {
{ .dsf = 0,
+ .video_stype = 0x0,
.frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */
.difseg_size = 10,
.n_difchan = 1,
@@ -2552,6 +2554,7 @@ static const DVprofile dv_profiles[] = {
.audio_shuffle = dv_audio_shuffle525,
},
{ .dsf = 1,
+ .video_stype = 0x0,
.frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */
.difseg_size = 12,
.n_difchan = 1,
@@ -2571,6 +2574,7 @@ static const DVprofile dv_profiles[] = {
.audio_shuffle = dv_audio_shuffle625,
},
{ .dsf = 1,
+ .video_stype = 0x0,
.frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */
.difseg_size = 12,
.n_difchan = 1,
@@ -2590,6 +2594,7 @@ static const DVprofile dv_profiles[] = {
.audio_shuffle = dv_audio_shuffle625,
},
{ .dsf = 0,
+ .video_stype = 0x4,
.frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */
.difseg_size = 10, /* also known as "DVCPRO50" */
.n_difchan = 2,
@@ -2609,6 +2614,7 @@ static const DVprofile dv_profiles[] = {
.audio_shuffle = dv_audio_shuffle525,
},
{ .dsf = 1,
+ .video_stype = 0x4,
.frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */
.difseg_size = 12, /* also known as "DVCPRO50" */
.n_difchan = 2,
@@ -2663,22 +2669,22 @@ enum dv_pack_type {
static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
{
- if ((frame[3] & 0x80) == 0) { /* DSF flag */
- /* it's an NTSC format */
- if ((frame[80*5 + 48 + 3] & 0x4) && (frame[80*5 + 48] == dv_video_source)) { /* 4:2:2 sampling */
- return &dv_profiles[3]; /* NTSC 50Mbps */
- } else { /* 4:1:1 sampling */
- return &dv_profiles[0]; /* NTSC 25Mbps */
- }
- } else {
- /* it's a PAL format */
- if ((frame[80*5 + 48 + 3] & 0x4) && (frame[80*5 + 48] == dv_video_source)) { /* 4:2:2 sampling */
- return &dv_profiles[4]; /* PAL 50Mbps */
- } else if ((frame[5] & 0x07) == 0) { /* APT flag */
- return &dv_profiles[1]; /* PAL 25Mbps 4:2:0 */
- } else
- return &dv_profiles[2]; /* PAL 25Mbps 4:1:1 */
- }
+ int i;
+
+ int dsf = (frame[3] & 0x80) >> 7;
+
+ int stype = frame[80*5 + 48 + 3] & 0x1f;
+
+ /* 576i50 25Mbps 4:1:1 is a special case */
+ if (dsf == 1 && stype == 0 && frame[5] & 0x07) {
+ return &dv_profiles[2];
+ }
+
+ for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++)
+ if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
+ return &dv_profiles[i];
+
+ return NULL;
}
static inline const DVprofile* dv_codec_profile(AVCodecContext* codec)
OpenPOWER on IntegriCloud